<?PHP

session_start();

if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {

header ("Location: index.php");

}

//ADD THE POSTED DATA TO THE DATABASE UNDER THE CURRENT SESSION USER ID
$fcomid = "";
$errorMessage = "";
$num_rows = 0;
$notification = "";
$fmemid = "";
$fname = "";
$fsurname = "";
$femail = "";
$fpassword = "";

function quote_smart($value, $handle) {

   if (get_magic_quotes_gpc()) {
       $value = stripslashes($value);
   }

   if (!is_numeric($value)) {
       $value = "'" . mysql_real_escape_string($value, $handle) . "'";
   }
   return $value;
}
	$fcomid = $_SESSION['comid'];
	$fmemid = $_SESSION['memid'];
	$famount = $_POST['amount'];
$ffor = $_POST['for'];
$htmldate = $_REQUEST['tdate'];
$fdate = strtotime($htmldate);


	$fcomid = htmlspecialchars($fcomid);


	//====================================================================
	//	Write to the database
	//====================================================================


require 'config.php';

	$db_handle = mysql_connect($server, $user_name, $pass_word);
	$db_found = mysql_select_db($database, $db_handle);

	if ($db_found) {

$fcomid = quote_smart($fcomid, $db_handle);

$memquery = "SELECT * FROM  members WHERE id = $fmemid and comid = $fcomid";
	$memsult = mysql_query($memquery) or die(mysql_error());
	$memrow = mysql_fetch_array($memsult);
	$memname = $memrow['name'];
	$memsurname = $memrow['surname'];
	$mememail = $memrow['email'];

	//====================================================================

	//====================================================================

			mysql_close($db_handle);


		}
else
{
$errorMessage = "<h4 align=\"center\" style=\"color:#0C0\">Database not found</h4>";
}
if ($_SERVER['REQUEST_METHOD'] == 'POST'){

	// THIS IS DONE ONLY IF THE USER CHOOSES TO UPDATE THE DETAILS

	}




?>

<!DOCTYPE html>
<html><head>
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
  <meta name="apple-mobile-web-app-capable" content="yes">
   <meta name="apple-mobile-web-app-status-bar-style" content="black">

   
 <title>iPetty Profile</title>
  
  
  
  <link rel="stylesheet" href="/jquery/style.css">
  
  <!-- Extra Codiqa features -->
  <link rel="stylesheet" href="codiqa.ext.css">
  <link href="style" rel="stylesheet" type="text/css">
  <link href="styling.css" rel="stylesheet" type="text/css">
  
  <!-- jQuery and jQuery Mobile -->
  <script src="https://d10ajoocuyu32n.cloudfront.net/jquery-1.9.1.min.js"></script>
  <script src="https://d10ajoocuyu32n.cloudfront.net/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>

  <!-- Extra Codiqa features -->
  <script src="https://d10ajoocuyu32n.cloudfront.net/codiqa.ext.js"></script>
  
</head>
<body>
<!-- Home -->
<div data-role="page" id="page1">
    <div data-theme="a" data-role="header">
        <h3>
            <?php echo $memname." ".$memsurname."'s Profile";?>
        </h3>
        <?php //NAVBAR
		require 'navbar.php';
		 ?>
    </div>
    <div data-role="content">
<h1>UNDER CONSTRUCTION</h1>
<h1><?php echo $memname." ".$memsurname." ".$mememail;?></h1>

<form id="passform">
<fieldset data-role="fieldcontain"><input id="password" name="password" placeholder="Password" type="password" /></fieldset>
<fieldset data-role="fieldcontain"><input id="password_again" name="password_again" placeholder="Confirm Password" type="password" /></fieldset>
<br>
<input type="submit" value="Validate!">
</form>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="jquery.validate.js"></script>
<script src="http://jquery.bassistance.de/validate/additional-methods.js"></script>
<script>
// just for the demos, avoids form submit
jQuery.validator.setDefaults({
  debug: true,
  success: "valid"
});
$( "#passform" ).validate({
  rules: {
    password: "required",
    password_again: {
      PassequalTo: "#password"
    }
  }
});
</script>
</div>
</body>
</html>
